#include "junix.h"
using namespace std;

int main(int argc, char **argv)
{
	vector<int> v1(10), v2(10);
	generate(v1.begin(),v1.end(),
			boost::bind(modulus<int>(), boost::bind(rand), 10));
	generate(v2.begin(), v2.end(), 
			boost::bind(modulus<int>(), boost::bind(rand), 10));

	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());

	ostream_iterator<int> oit(cout, " ");
	copy(v1.begin(),v1.end(), oit);
	cout<<endl;
	copy(v2.begin(),v2.end(), oit);
	cout<<endl;

	vector<int> v3;
	merge(v1.begin(), v1.end(),
			v2.begin(),v2.end(),
			back_inserter(v3));

	copy(v3.begin(), v3.end(), oit);
	cout<<endl;
}
